/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Vistas;

/**
 *
 * @author pedro
 */
import java.awt.*;
import java.awt.event.*;
import java.beans.PropertyChangeEvent;
import javax.swing.*;
import Dominio.CtrlDominio;
import java.beans.PropertyChangeListener;

public class ProgresBar extends JPanel
                             implements ActionListener, 
                                        PropertyChangeListener {

    private CtrlDominio CD = CtrlDominio.getInstance();
    JProgressBar progressBar;
    JTextArea out;
    JButton find;
    Thread runner;
    int num = 0;
    int max;
    int dicc;

    public ProgresBar(int max, int dicc, String title) {
        setSize(400, 200);
        this.dicc = dicc;
        this.max = max;
        //setLayout(new FlowLayout());
        progressBar = new JProgressBar(0, 100);
        progressBar.setValue(0);
        progressBar.setStringPainted(true);
        add(progressBar);
        }
    private static void createAndShowGUI() {
        //Create and set up the window.
        JFrame frame = new JFrame("ProgressBarDemo");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        //Create and set up the content pane.
        JComponent newContentPane = new ProgresBar(1,1,"hola");
        newContentPane.setOpaque(true); //content panes must be opaque
        frame.setContentPane(newContentPane);

        //Display the window.
        frame.pack();
        frame.setVisible(true);
    }
    public void iterate() {
        while (num < 100) {
            progressBar.setValue(num);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
            }
            num += 2;System.out.println("estoy en progresbar,Palabra: "+num/*+"("+CD.sizeDic(dicc) +")"*/+" y total: "+CD.actual);
        }
    }
    public static void main(String[] args) {
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
            }
        });
    }
    public void actionPerformed(ActionEvent e) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void propertyChange(PropertyChangeEvent evt) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    
}
